<?php
/**
 * Created by PhpStorm.
 * User: LAI
 * Date: 5.8.14
 * Time: 12.27
 */

function login_controller($cookie_login,$session_login){
  if (!login_switch_controller($cookie_login,$session_login)){
    header("Location:http://localhost/IShop.com/nonlogined_main_page.php");
  }
}

function login_switch_controller($cookie_login, $session_login){
  if (login_cookie_controller($cookie_login)){
    return true;
  }
  elseif (login_session_controller($session_login)){
    return true;
  }
  else return false;
}

function login_cookie_controller($cookie_login){
  if (isset($cookie_login)){
    return false;
  }
  return true;
}

function login_session_controller($session_login){
  if (isset($session_login)){
    return false;
  }
  return true;
}